home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 12 Dec 1996
- // Author: spam
- //
- // Description:
- // Assign the nodes in thisNode[] to the second node.
- //
-
- global proc assignShadingGroups(string $thisNode[], string $toThisNode)
- //
- // Procedure Name:
- // assignShadingGroups
- //
- // Description:
- // Implements a render assign. The names in the array should all be
- // names of renderable geometry. If $toThisNode is a shadingEngine (SE),
- // each array element is added as a member of it. If $toThisNode isn't
- // an SE, the optionVar "assignPref" is checked. If True, a new SE is
- // created, each array element is added as a member, and $toThisNode is
- // attached to the surfaceshader attr of the new SE.
- //
- // Input Arguments:
- // string $thisNode[] - array of nodes to assign
- // string $toThisNode - single node name to assign *to*
- //
- // Return Value:
- // None.
- //
- {
- string $toType = `nodeType $toThisNode`;
- string $SEname = $toThisNode;
- string $cmd;
- string $exitVal = "OK";
-
- if($toType != "shadingEngine") {
- $exitVal = `confirmDialog -title "WARNING" -message
- ($toThisNode + " is not a Shading Group. Geometry can only be assigned to"
- + "\nShading Groups. Press OK to create a new Shading Group that shades" +
- "\nwith " + $toThisNode + " and perform the assignment, or Cancel to do nothing.")
- -button "OK" -button "Cancel"
- -defaultButton "OK" -cancelButton "Cancel"
- -dismissString "Cancel"`;
-
- if ($exitVal == "OK") {
-
- $cmd = "sets -renderable true -noSurfaceShader true -name " + $toThisNode + "SG -empty";
- $SEname = `evalEcho $cmd`;
-
- $cmd = "defaultNavigation -f true -connectToExisting -source " + $toThisNode + " -destination " + $SEname;
- evalEcho $cmd;
- }
- }
-
- if ($exitVal == "OK") {
- $cmd = "sets -e -forceElement " + $SEname;
-
- int $i;
- int $numNodes = `size $thisNode`;
-
- for ($i = 0; $i < $numNodes; $i++) {
- $cmd += " " + $thisNode[$i];
- }
-
- evalEcho $cmd;
- }
- }
-